<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>ES6的新功能</title>
</head>
<body>
<script>
let name = 'LiMin',
  age = 26;
let person = {
      name,
      age,
      sayName() {
         console.log(this.name)
  }
}

function User(name, age) {
  this.name = name;
  this.age = age;
  this.sayName = function () {
    console.log(this.name);
  }
}

class User{
  // 这是类的写法，不是ES6函数简写
  constructor(name, age) {
    this.name = name;
    this.age = age;
  }
  
  sayName() {
    console.log(this.name);
  }
}
</script>	
</body>
</html>